/*
 * TestRSAPubMethod.cpp
 *
 *   Created on: 2010-3-28     
 *  Description: 
 *    Copyright: 2010 @ ICT Li Heyuan
 */

#include "../include/client/TcpClient.h"
#include "../include/json_cpp/value.h"
#include "../include/util/Const.h"
using Json::Value;

#include <iostream>
using std::cout;
using std::cerr;
using std::endl;

void testEncryptCall()
{
	TcpClient client("127.0.0.1", 8081);
	client.setEncrypt(true);

	Value param, ret;
	param.append(Value(2));
	param.append(Value(1));
	if (!client.call("add", param, ret))
	{
		cerr << "fail:" << ret.asString() << endl;
	}
	else
	{
		cout << "success:" << ret.asInt() << endl;
	}

}

void testEncryptNotification()
{
	TcpClient client("127.0.0.1", 8081);
	client.setEncrypt(true);

	Value param;
	param.append(Value(2));
	param.append(Value(1));
	if (!client.notification("add", param))
	{
		cerr << "fail" << endl;
	}
	else
	{
		cout << "success" << endl;
	}

}

/*
int main()
{
	//	testEncryptCall();
	//	testEncryptNotification();
	AESTools aes("1234567890123456");
	cout << aes.encryptWithBase64("12345") << endl;
}
*/

